package com.alibaba.controller;

import com.alibaba.domain.User;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

//暴露接口给 订单服务访问
@RestController
public class UserController {

    //加载端口
    @Value("${server.port}")
    private Long port;


    // @GetMapping(value = "/user/{id}" )
    @RequestMapping(value = "/getUserById/{id}",method = RequestMethod.GET)
    public User getUserById(@PathVariable("id") Long id){
        //根据id去数据库 查询user
        return User.builder().id(id).username("谌媾觏").intro("我丢了我心爱的三级头和平底锅" + port).build();
    }

//    @GetMapping("/getUserById/{id}")
//    public User getUserById(@PathVariable Long id){
//        //按照正常的逻辑   应该拿着id  到数据库中查找数据
//
//        return User.builder().id(id).name("马威").intro("我叫马威  我要打十个"  +  port).build();
//    }

}
